package com.hsg.lsn13.receiver;


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;

import com.hsg.lsn13.manager.KeepManager;

public class KeepReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        if(null!=intent){
            String action = intent.getAction();
            if(null!=action){
                if(TextUtils.equals(action,Intent.ACTION_SCREEN_OFF)){//熄屏时打开0像素的KeepActivity界面
                    KeepManager.getOurInstance().startKeep(context);
                }else if(TextUtils.equals(action,Intent.ACTION_SCREEN_ON)){//亮屏时 关闭 界面
                    Log.d("lsn13", "KeepReceiver ACTION_SCREEN_ON");
                    KeepManager.getOurInstance().finishKeep(context);
                }
            }
        }
    }
}
